package experiment1;

/**
 * @Auther:云尚学Java
 * 汉诺(Hanoi)塔问题
 */
public class Test3 {
    public static void main(String args[]){
        f(3,'A','B','C');
    }
    public static void f(int i, char a,char b,char c){
        if(i==1){
            System.out.println("把第"+i+"个盘子从"+a+"移动到"+c);
            return;
        }
        f(i-1,a,c,b);
        System.out.println("把第"+i+"个盘子从"+a+"移动到"+c);
        f(i-1,b,a,c);
    }
}
